package com.kitty.game.mail;

import com.kitty.game.mail.model.Mail;

import java.util.HashMap;
import java.util.Map;

public class MailBox {
    /**key:邮件ID value:Mail*/
    private Map<String, Mail> allMail =new HashMap<>();

    /**取所有Mail*/
    public Map<String, Mail> getAllMail() {
        return allMail;
    }

    /**邮件ID取邮件*/
    public Mail getMail(String mailId){
        return allMail.get(mailId);
    }

    /**添加一个邮件*/
    public void addMail(Mail mail){
        allMail.put(mail.getId(),mail);
    }

    /**修改邮件状态*/
    public Mail modifyMail(String mailId, short state){
        Mail mail =getMail(mailId);
        if(mail==null){
            return null;
        }
        mail.setStatus(state);
        return mail;
    }
}
